\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size

\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{fourier} % Use the Adobe Utopia font for the document - comment this line to return to the LaTeX default
\usepackage[english]{babel} % English language/hyphenation
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage[UTF8]{ctex}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{tikz}
\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\usepackage{clrscode}
\usepackage{sectsty} % Allows customizing section commands
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{float}
\usepackage[colorlinks,linkcolor=red]{hyperref}
\usetikzlibrary{graphs}
\usetikzlibrary{shapes.arrows}
\allsectionsfont{\centering \normalfont\scshape} % Make all sections centered, the default font and small caps

\usepackage{fancyhdr} % Custom headers and footers
\pagestyle{fancyplain} % Makes all pages in the document conform to the custom headers and footers
\fancyhead{} % No page header - if you want one, create it in the same way as the footers below
\fancyfoot[L]{} % Empty left footer
\fancyfoot[C]{} % Empty center footer
\fancyfoot[R]{\thepage} % Page numbering for right footer
\renewcommand{\headrulewidth}{0pt} % Remove header underlines
\renewcommand{\footrulewidth}{0pt} % Remove footer underlines
\setlength{\headheight}{13.6pt} % Customize the height of the header

\numberwithin{equation}{section} % Number equations within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{figure}{section} % Number figures within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{table}{section} % Number tables within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)

\setlength\parindent{0pt} % Removes all indentation from paragraphs - comment this line for an assignment with lots of text

%----------------------------------------------------------------------------------------
%	TITLE SECTION
%----------------------------------------------------------------------------------------

\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height

\title{
\normalfont \normalsize
\textsc{中国科学院大学}\ \textsc{计算机与控制学院} \\ [25pt] % Your university, school and/or department name(s)
\horrule{0.5pt} \\[0.4cm] % Thin top horizontal rule
\huge 图像处理与分析第五次作业 \\ % The assignment title
\horrule{2pt} \\[0.5cm] % Thick bottom horizontal rule
}

\author{黎吉国&201618013229046} % Your name

\date{\normalsize\today} % Today's date or a custom date

\begin{document}

\maketitle % Print the title
\newpage
\section{answer for 1st}
对于公式
\[
\hat{f}(x,y)=\frac{\sum_{(s,t)\in S_{xy}}g(s,t)^{Q+1}}{\sum_{(s,t)\in S_{xy}}g(s,t)^{Q}}
\]
给出的逆谐波滤波回答一下问题：
\begin{enumerate}
  \item 解释为什么当$Q$是正值时滤波对去除胡椒噪声有效
  \item 解释为什么当$Q$是正值时对去除盐噪声有效
\end{enumerate}
\textbf{Solution:}\\
\[
\begin{split}
  \hat{f}(x,y)&=\frac{\sum_{(s,t)\in S_{xy}}g(s,t)^{Q+1}}{\sum_{(s,t)\in S_{xy}}g(s,t)^{Q}}\\
  &= \sum_{(s',t')\in S_{xy} }\frac{ g(s',t')^{Q} }{\sum_{(s,t)\in X_{xy}}g(s,t)^{Q}}g(s',t')\\
  &= \sum_{(s',t')\in S_{xy} } \lambda(s',t')g(s',t')
\end{split}
\]
从上式可以看出，$Q$的取值直接影响滑窗中每个点的比例
\begin{enumerate}
  \item
  $Q=0:$滑窗中每个点的比例相同，起到了平滑的作用
  \item
  $ Q<0:$滑窗中的极大值的比例将非常小，具有极大值的盐噪声将被大大削弱，起到了抑制局部“盐”噪声的作用
  \item
  $Q>0:$滑窗中的极小值的比例将非常小，具有极小值的“胡椒”噪声将被削弱，起到了抑制“胡椒”噪声的作用
\end{enumerate}

\newpage
\section{answer for 2ed}
请理解课本中最佳陷波滤波器进行图像复原的过程，推导出$w(x,y)$最有解的计算过程，即从
\[\frac{\partial\sigma^2(x,y)}{\partial \omega(x,y)}=0\]
到
\[\omega(x,y)=\frac{\overline{\eta(x,y)g(x,y)}-\overline{g}(x,y)\overline{\eta}(x,y)}{\overline{\eta^2}(x,y)-\overline{\eta}^2 (x,y)}\]

\[
\begin{split}
\text{we know that}&\\
 \sigma^2 &= \frac{1}{(2a+1)(2b+1)}\sum_{s=-a}^{a}\sum_{t=-b}^{b}\{[g(x+s,y+t)-\omega(x,y)\eta(x+s,y+t)]-[\overline{g}(x,y)-\omega(x,y)\overline{\eta}(x,y)] \}^2\\
 \text{and}&\\
\frac{\partial \sigma^2(x,y)}{\partial \omega(x,y)} &= \frac{1}{(2a+1)(2b+1)}\sum_{s=-a}^{a}\sum_{t=-b}^{b}\{(g(x+s,y+t)-\omega(x,y)\eta(x+s,y+t)-\overline{g}(x,y)+\omega(x,y)\overline{\eta}(x,y))\\
&(\eta(x+s,y+t)-\overline{\eta}(x,y)) \}\\
&= \overline{\eta}(x,y)\overline{g}(x,y)-\overline{\eta(x,y)g(x,y)}+\omega(x,y)(\overline{\eta^2(x,y)}-\overline{\eta(x,y)}^2)\\
&= 0\\
\text{we can get}&\\
\omega(x,y)&=\frac{\overline{\eta(x,y)g(x,y)} - \overline{\eta}(x,y)\overline{g}(x,y)}{\overline{\eta^2(x,y)}-\overline{\eta(x,y)}^2}
\end{split}
\]

\newpage
\section{answer for 3th}
请证明频域带通滤波器与带阻滤波器之间的关系
\[ H_{bp}(u,v)=1-H_{br}(u,v) \]
下面简单说明两者的关系：\\
假设$H_{br}(u,v)$抑制频率在$[D_0-W/2,D_0+W/2]$的信号，其余信号基本衰减，则$1-H_{bp}(u,v)$则抑制了$[D_0-W/2,D_0+W/2]$之外的信号，只通过这个频率带想信号，所以是一个贷通滤波器。


\end{document}
